#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "Image.h"
#include "Matrix.h"
#include <QMainWindow>
#include <QMainWindow>
#include <QMenuBar>
#include <QMenu>
#include <QAction>
#include <QLabel>
#include <QPixmap>
#include <QImage>
#include <QObject>
#include <QFileDialog>
#include <QDebug>
#include <QPainter>
#include <QEvent>
#include <QMouseEvent>
#include <QRect>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void Show_Changed_Image();
    Image img_qrc;
    Image img[10]; //撤销核心数组
        int i=0,j=0,k =0;//撤销核心变量
        bool full = false;
    int last_time_brt = 0;
    int last_time_color = 0;
    char* last_filename;

    QPixmap  pix_src,pix_fix;//原始图片及缩放图片
        QRect paint_rect;           //绘画限制区域
        int paint_x_exp,paint_y_exp,paint_w_exp,paint_h_exp;//期望绘画区域
        int paint_x,paint_y,paint_w,paint_h;//实际绘画区域
        int pix_sx,pix_sy;          //选择图片的起始x、y开始绘画
        int step_val = 20;          //单次移动步长
        bool mouse_press_flag = false;//鼠标是否按下
        QPoint mouse_pos_pre,mouse_pos_cur;//记录鼠标位置

    void Initalize();
    void ijia();
      void before();
      void next();

      void Reset_photo();
      void Update_photo();
public slots:

    bool event(QEvent *event);

      void mouseDoubleClickEvent(QMouseEvent *event);   //双击复原图像

    void paintEvent(QPaintEvent *event);

private slots:

    void on_Rotate_Left_clicked();

    void on_Rotate_Right_clicked();

    void on_Turned_Over_clicked();

    void on_Left_to_Right_clicked();

    void on_upanddown_clicked();

    void on_File_Open_triggered();

    void on_File_Save_triggered();

    void on_Brightness_adjuster_valueChanged(int value);


    void on_warm_cold_change_valueChanged(int value);

    void on_Un_Do_clicked();



    void on_Make_it_again_clicked();

    void on_Save_As_triggered();

    void on_gray2bw_editingFinished();

    void on_Resize_clicked();

    void on_Cut_clicked();

    void on_warm_cold_change_sliderPressed();

    void on_warm_cold_change_sliderReleased();

    void on_Brightness_adjuster_sliderPressed();

    void on_Brightness_adjuster_sliderReleased();

    void on_gray_clicked();

    void on_mean_clicked();

    void on_median_clicked();

    void on_to_GrayandWhite_clicked();

    void on_Convex_clicked();

    void on_Edge_detection_clicked();

private:

    Ui::MainWindow *ui;

};
#endif // MAINWINDOW_H
